/**
 * 
 */
package csab;

import java.util.ArrayList;

import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.BasicGameState;
import org.newdawn.slick.state.StateBasedGame;

/**
 * @author David Young
 *
 */
public class OptionMenuState extends BasicGameState {
	private int stateid;
	private Image bg;
	private ArrayList<MenuObject> buttonlist;
	
	public OptionMenuState(int id)
	{
		stateid = id;
	}
	
	/* (non-Javadoc)
	 * @see org.newdawn.slick.state.GameState#init(org.newdawn.slick.GameContainer, org.newdawn.slick.state.StateBasedGame)
	 */
	@Override
	public void init(GameContainer container, StateBasedGame game)
			throws SlickException {
		buttonlist = new ArrayList<MenuObject>();
		
		//Calculate orientation
		int numitems = 10;
		int offset = container.getHeight() / 2;
		
		//Add buttons to menu
		buttonlist.add(new MenuObject(container.getWidth() / 2, offset + (container.getHeight() - offset) / numitems, 
									  "Aspect 4:3", fnt, released, pressed));
		buttonlist.add(new MenuObject(container.getWidth() / 2, offset + (container.getHeight() - offset) / numitems * 2, 
									  "Aspect 16:9", fnt, released, pressed));
		buttonlist.add(new MenuObject(container.getWidth() / 2, offset + (container.getHeight() - offset) / numitems * 3,
									  "Aspect 16:10", fnt, released, pressed));
	}

	/* (non-Javadoc)
	 * @see org.newdawn.slick.state.GameState#render(org.newdawn.slick.GameContainer, org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.Graphics)
	 */
	@Override
	public void render(GameContainer container, StateBasedGame game, Graphics g)
			throws SlickException {
		bg.draw(0, 0);
		for(MenuObject obj : buttonlist)
		{
			obj.draw();
		}
	}

	/* (non-Javadoc)
	 * @see org.newdawn.slick.state.GameState#update(org.newdawn.slick.GameContainer, org.newdawn.slick.state.StateBasedGame, int)
	 */
	@Override
	public void update(GameContainer container, StateBasedGame game, int delta)
			throws SlickException {
		// TODO Auto-generated method stub

	}

	/* (non-Javadoc)
	 * @see org.newdawn.slick.state.BasicGameState#getID()
	 */
	@Override
	public int getID() {
		// TODO Auto-generated method stub
		return stateid;
	}

}
